#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#define SIZE 10

void get_rand(char *p,  int length) {
        char value[10] = "0123456789";
        srand(time(NULL));
        for (int i = 0; i < length; ++i)
        {
            *(p + i) = value[rand() % 10];
        }
        *(p + SIZE) = '\0';
        return;
}
int main()
{
        unsigned char value[SIZE] = {0};
        get_rand(value, SIZE);
        printf("获取%d字节的随机数: %s\n", SIZE,value);
        return 0;
}